<template>
    <div class="income-template">
        <yd-navbar slot="navbar" title="经营信息" class="public-header">
            <span slot="left">
                <a href="javascript:window.history.go(-1)"><yd-navbar-back-icon></yd-navbar-back-icon></a>
            </span>
        </yd-navbar>
        <yd-slider autoplay="3000">
            <yd-slider-item v-for="item in data.detail_pic">
                <a href="javascript:;">
                    <img :src="item.image">
                </a>
            </yd-slider-item>
        </yd-slider>
        <div class="income-content">
            <h3 class="income-title">店铺：{{data.shop_name}}</h3>
            <yd-cell-group title="主要经营信息(元)">
                <yd-cell-item>
                    <span slot="left">平均业绩/日</span>
                    <span slot="right">{{data.daysAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">毛利率</span>
                    <span slot="right">{{data.grossProfit}}%</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">店铺租金/日</span>
                    <span slot="right">{{data.leaseAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">员工工资/日</span>
                    <span slot="right">{{data.saralyAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">员工提成/日</span>
                    <span slot="right">{{data.commissionAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">水电费/日</span>
                    <span slot="right">{{data.ewaterAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">工商税收/日</span>
                    <span slot="right">{{data.businessTaxAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">经营耗材/日</span>
                    <span slot="right">{{data.operatingSuppliesAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">商品耗损/日</span>
                    <span slot="right">{{data.commodityAverage}}</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left">日均利润/日</span>
                    <span slot="right">{{data.profitAverage}}</span>
                </yd-cell-item>
            </yd-cell-group>
            <h3 class="income-title">其他经营信息</h3>
            <yd-cell-group title="公司管理佣金">
                <yd-cell-item>
                    <span slot="left">数值</span>
                    <span slot="right">{{data.commission_percent}}%</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left" style="white-space:normal">备注：当本店经营有利润时，公司按该比例提取利润的部分作为公司管理佣金 </span>
                </yd-cell-item>
            </yd-cell-group>
            <yd-cell-group title="经营股东佣金">
                <yd-cell-item>
                    <span slot="left">数值</span>
                    <span slot="right">{{data.operate_percent}}%</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left" style="white-space:normal">备注：当本店经营有利润时，经营股东按该比例提取利润的部分作为股东佣金 </span>
                </yd-cell-item>
            </yd-cell-group>
            <yd-cell-group title="经营储备金">
                <yd-cell-item>
                    <span slot="left">数值</span>
                    <span slot="right">{{data.reserve_percent}}%</span>
                </yd-cell-item>
                <yd-cell-item>
                    <span slot="left" style="white-space:normal">备注：当本店经营有利润时，按该比例提取利润的部分作为公司经营储备金 </span>
                </yd-cell-item>
            </yd-cell-group>
        </div>
        <yd-tabbar slot="tabbar" class="public-footer">
            <yd-tabbar-item title="首页" link="/">
                <yd-icon name="home" slot="icon"></yd-icon>
            </yd-tabbar-item>
            <yd-tabbar-item title="投资收益" link="/income" active>
                <yd-icon name="shopcart-outline" slot="icon"></yd-icon>
            </yd-tabbar-item>
            <yd-tabbar-item title="信息交流" link="/message">
                <yd-icon name="like-outline" slot="icon"></yd-icon>
            </yd-tabbar-item>
            <yd-tabbar-item title="个人中心" link="/user">
                <yd-icon name="ucenter-outline" slot="icon"></yd-icon>
            </yd-tabbar-item>
        </yd-tabbar>
    </div>
</template>
<script>
    import Ajax from "../api/ajax.js"
    import dataURL from "../data/dataURL.js"
    export default {
        data() {
            return {
                queryID: '',
                loadBloean:true,
                data: {
                    "shop_name": "",
                    "cover_pic": [],
                    "intro": "",
                    "daysAverage": "",// 平均业绩
                    "leaseAverage": "",// 租金
                    "saralyAverage": "",// 工资
                    "commissionAverage": "",// 提成
                    "ewaterAverage": "",// 水电
                    "businessTaxAverage": "",// 工商税
                    "operatingSuppliesAverage": "",// 经营耗材
                    "commodityAverage": "",// 商品损耗
                    "profitAverage": "",// 日均利润
                    "commission_percent": '',// 公司管理佣金
                    "operate_percent": '',// 经营股东佣金
                    "reserve_percent": ''// 经营储备金
                }
            }
        },
        methods: {
            // 页面初始化调用
            async getData() {
                this.queryID = this.$route.query.id;
                let res = await Ajax.Post(dataURL.income.bussinessInfo, {
                    shop_id: this.queryID
                });
                this.data = res;
                console.log(res)
                this.loadBloean=false;
            },
        },
        computed: {
            showLoading() {
                if (this.loadBloean) {
                    this.$dialog.loading.open('很快加载好了');
                } else {
                    this.$dialog.loading.close();
                }
            }
        },
        mounted() {
            this.getData();
        }
    }

</script>